<template>
  <el-descriptions
    class="margin-top"
    title="我的资料"
    :column="3"
    size="size"
    border
  >
    <template slot="extra">
        <el-button type="primary" size="small" @click="handleClick">修改资料</el-button>
    </template>

    <el-descriptions-item>
      <template slot="label">
        <i class="el-icon-user"></i>
        用户名 </template
      >{{ person.account }}

    </el-descriptions-item>

    <el-descriptions-item>
      <template slot="label"><i class="el-icon-male"></i> 性别</template>
      {{ person.gender }}
    </el-descriptions-item>


    <el-descriptions-item>
      <template slot="label">
        <i class="el-icon-mobile-phone"></i>
        所在区域</template>
        {{ person.area }}
    </el-descriptions-item>

    <el-descriptions-item>
      <template slot="label">
        <i class="el-icon-location-outline"></i>
        身份证号</template
      >{{ person.idCard }}
    </el-descriptions-item>

    <el-descriptions-item>
      <template slot="label">
        <i class="el-icon-bicycle"></i>
        出生日期</template
      >{{ person.birthDate }}
    </el-descriptions-item>

    <el-descriptions-item>
      <template slot="label">
        <i class="el-icon-office-building"></i>
        政治面貌</template
      >{{ person.politicsStatus }}
    </el-descriptions-item>

    <el-descriptions-item>
      <template slot="label">
        <i class="el-icon-bicycle"></i>
        实名信息</template
      ><el-tag size="small">{{ infotag[realstatus] }}</el-tag>
      <el-button
        type="primary"
        size="small"
        style="margin-left: 30px"
        @click="goto"
        >{{ btnmsg[realstatus] }}</el-button
      >
    </el-descriptions-item>
  </el-descriptions>
</template>

<script>
export default {
  name: "PersonInfo",
  data() {
    return {
      infotag: ["已实名", "未实名"],
      btnmsg: ["查看实名信息", "进行实名认证"],
      realstatus: 0, //0是已实名 1是未实名
      person: {},
    };
  },
  methods: {
    goto() {
      if (this.realstatus === 0) {
        window.location.href = "";
      } else {
        // 开始实名认证
      }
    },
    getUserInfo() {
      this.person = this.$store.state.userInfo;
    },
    handleClick() {
      this.$router.push('/personform/' + 0);
    }
  },
  created() {
    // 通过用户账号查询用户信息 返回用户的所有信息包括是否实名
    this.getUserInfo();
  },
};
</script>

<style>
</style>